home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 20
/
Cream of the Crop 20 (Terry Blount) (1996).iso
/
program
/
n_b_v203.zip
/
M_SETUP.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
5KB
|
97 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME M_SETUP .DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
$INCLUDE "DAS-NB02.INC"
COLOR 7, 0
CLS
? "┌────────────────────────────────────────────────────────────────
? "│ fMouseSETUP? ( ActiveButtons? )
? "├───────────────────────────────────────────────────────────────────
? "│ Actually, there are several mouse routines demonstrated here. Have
? "│ a good look at the code and the remarks for a full explanation.
? "├──────────────────────────────────────────────────────────────────────
? "│ One VERY important thing to study is the use of fGetKey% and how it can
? "│ centeralize user input, trap certain keys and/or clicks and re-route
? "│ the program from one location. In an extremely complicated program this
? "│ one function can grow to amazing size as it becomes the driving force
? "│ for everything else including the main menu! It also reduces debugging
? "│ time, can run self-operating demos, and almost anything else you can
? "│ think of.
? "└────────────────────────────────────────────────────────────────────────
COLOR 14, 0
LOCATE 25, 1 : PRINT "PRESS <ALT>X OR CLICK HERE TO TERMINATE THE PROGRAM";
COLOR 7, 0
LOCATE 18, 50 : PRINT "┌─┐"
LOCATE 19, 50 : PRINT "│ │ The mouse starts here"
LOCATE 20, 50 : PRINT "└─┘"
Mreport$ = "Button: ## Row: ## Col: ##"
Buttons? = 0 ' use any/all buttons available
' try changing to 1, 2, 3 etc.
'
IF fMouseSETUP?( Buttons? ) = 0 THEN END ' gotta have a mouse for this one
MouseLOCATE 19, 51 ' put the mouse where we want it
MouseON ' make the mouse visible
DO ' working loop
G% = fGetKey% ' wait for some user action
MouseCoffT2 16, 1, 1, 28 ' conditional mouse off
LOCATE 16, 1 '
IF G% = 0 THEN ' no key-press so it was a mouse
B% = fMouseSTATsT%( Row?, Col? ) ' get mouse status
PRINT USING Mreport$; B%, Row?, Col? ' print mouse data
ELSE '
PRINT "YOU PRESSED: ";G$ SPACE$(16) ' report key-press
END IF '
MouseON ' mouse visible again
LOOP '
'
BYEBYE: ' a graceful exit
MouseOFF ' turn the mouse off
CLS ' clear the screen
END ' end program
'
'════════════════════════════════════════════════════════════════════════════
FUNCTION fGetKey% () LOCAL PUBLIC
LOCAL G%, B%
DO
IF INSTAT THEN ' is there a key-press waiting?
G% = CVI( INKEY$ + CHR$(0) ) ' gather it from the buffer
SELECT CASE G% ' anything special about it?
CASE ( 59 * 256 ) ' F-1 call the help routine
CASE ( 45 * 256 ) : GOTO BYEBYE ' ALT-X so end the program
CASE 124 ' we keep "|" from the user
CASE ELSE : EXIT LOOP ' all other keys exit
END SELECT '
ELSE '
B% = fMouseGetKey% ' was/is there any mouse action
IF B% > 0 THEN ' has there been a "click"
fMouseSTATsT Row?, Col? ' get row?, col? of click
IF ( Row? = 25 ) AND _ ' exit program?
( Col? < 52 ) THEN GOTO BYEBYE '
END IF '
END IF '
LOOP UNTIL B% <> 0 '
'
FUNCTION = G% '
'
END FUNCTION '